package fr.janalyse

import javax.management.ObjectName
import javax.management.ObjectInstance
import java.rmi.MarshalledObject
import javax.management.openmbean.CompositeData
import javax.management.openmbean.CompositeDataSupport
import javax.management.openmbean.TabularData
import javax.management.openmbean.TabularDataSupport


package object jmx {

  implicit def string2objectName(name:String):ObjectName = new ObjectName(name)
  implicit def objectInstance2ObjectName(that:ObjectInstance):ObjectName = that.getObjectName
  implicit def objectName2RichMBean(that:ObjectName)(implicit ajmx:JMX) = RichMBean(that)
  implicit def string2RichMBean(that:String)(implicit ajmx:JMX):RichMBean = RichMBean(that)
  implicit def toMarshalledObject[A](that:A):MarshalledObject[A] = new MarshalledObject[A](that)

  implicit def compositeDataAsScalaWrapper(cd : CompositeData): CompositeDataWrapper = CompositeDataWrapper(cd)
  implicit def compositeDataSupportAsScalaWrapper(cd : CompositeDataSupport): CompositeDataSupportWrapper = CompositeDataSupportWrapper(cd)
  implicit def tubularDataAsScalaWrapper(td:TabularData):TabularDataWrapper = TabularDataWrapper(td)
  implicit def tubularDataSupportAsScalaWrapper(td:TabularDataSupport):TabularDataSupportWrapper = TabularDataSupportWrapper(td)

}